home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
3D Images
/
3D Images.iso
/
programs
/
amiga
/
genesis
/
csg
< prev
next >
Wrap
Text File
|
1995-02-09
|
7KB
|
147 lines
CSG approach
------------
CSG modellers are very few and far between, and those that you will
find will probably be mainframe based. The reason for this is that it
is a very new technique, and I have been fortunate enough to work with
some of the original pioneers of this technique. Moreover, I have
learnt most of the tricks used to keep execution speeds as quick as
possible and discovered many more of my own in doing the work I have
done so far. I know for a fact that the execution speeds I am currently
getting out of my amiga are as fast as those other people are getting
out of IBM RT risc based workstations (these are 32 bit machines with
floating point hardware), and faster than an IBM model 80 PS2.
For this reason alone I can garuantee that no-one will produce a
similar modeller as fast as this on machines in the same league as the
amiga. Execution speed has been my main consideration throughout.
The incentive for all this work is that I want to bring what is currently
considered mainframe domain graphics onto machines that everyone can
afford. However I must point out that all of the work I have done on
the amiga is totally original.
CSG objects are constructed from a basic set of solid primitives which
are combined in one of three ways. Once this is done, this object is
in itself a new primitive (that you've created), and can then be used
in place of any standard primitive.
The three ways of combining primitives and objects are;
Union - This is like gluing the objects together although they
can actually pass through one another. In fact one object
can be completely contained within another making it not
visable at all.
Intersection - The object resulting from this is comprised of ONLY the
overlapping part of the two objects. If the two objects
dont touch at any point the resulting object will be
emptyness.
Subtraction - This is where one primitive is taken away from another.
eg. subtracting a cylinder is the same as drilling a
hole, in real life. By designing an object and subtracting
it from a solid block, you've just made a MOULD for that
object.
The following primitives are currently supported;
Half plane - This is unlike the planes or polygons used by the more
conventional techniques. Because a model in CSG terms
has to be SOLID each of the primitives from which it is
constructed also has to be SOLID. A polygon or facet used
by convetional (surface) modellers is just a wafer thin
plane with a defined boundry (usually triangle), in other
words it has no depth. A CSG plane is an infinitly large
flat surface that divides the universe into a solid half
and an empty half (hence the term HALF plane). This on its
own is of little use, but by intersecting say, 6 half
planes a cube can be constructed. I plan to implement a
large selection of pre-defined primitives based on half
planes, eg. pyramids, cubes, hexagonal cylinders, prisms etc.
All in all the half plane is by far the most usefull
primitive. In fact some proffessional CSG modellers have
it as there only primitive! This however is more advanced
than your average proffessional system (he says modestly).
Sphere - Spheres are processed very quickly, although not as quickly
as half planes. Obviously the radius is variable.
Cylinder - The basic cylinder is infinitly long and is intersected
with half planes to truncate it to the desired length
(the program worries about this, the users just specifies
a length). Again any radius can be given.
Cone - Similarly the basic cone is an infinitly long double cone
(see the picture on this disk), and is truncated by half
planes by the program. The cone can be given any degree
of pointyness.
Ellipsoid - This is a 3D egg shape and can be given any degree of
pointyness or flatness (in mathmatical terms; all of the
semi-major axis lengths can be specified).
The easiest way to get a feel for how to build a model is to take you
through an simple example, you will soon pick up an intuitive feel
for how to construct a model of your own. The following model description
would result in something resembling a weight lifters bar bell (this is
the bar which has circular weights on either end). This example uses
only the cylinder primitive and only the union operator. It could also
be written more compactly than this but it serves as a good example.
Line
----
1 SmallWeight = Cylinder(12,4) at(0,30,30);
2 MedWeight = Cylinder(16,4) at(0,30,30);
3 LargeWeight = Cylinder(20,4) at(0,30,30);
4 RightSet = LargeWeight at(-4,0,0) union
5 MedWeight union
6 SmallWeight at(,0,0);
7 LeftSet = SmallWeight at(-4,0,0) union
8 MedWeight union
9 LargeWeight at(4,0,0);
10 Bar = Cylinder(5,100) at(200,30,30);
11 BarBell = Bar union
12 RightSet at(166,0,0) union
13 LeftSet at(234,0,0);
14 Draw BarBell XRotated(20) YRotated(15);
Explanation
-----------
Lines 1 - 3 Define three circular weights. They are made from short
fat cylinders running parallel to the x axis (The first
parameter is the radius, then the length) at a certain
distance above the ground and into the screen.
NB. the 'AT' keyword moves the primitive/object by a
given x,y,z offset.
Lines 4 - 9 Define first the set of weights on the left of the bar
then the set of weigths on the right (which is in fact
the mirror image of the left set). The weights are placed
next to each other in the x direction.
Line 10 Defines the actual bar itself as 100 units long and 5 in
radius and is positioned so that it runs through the
centre of the two sets. It is centred at 200 in x and
because it is 100 long, it will extend from 150 to
250 in the x direction.
Lines 11 - 13 Positions both sets of weights in the x direction
at either end of the bar with 10 units gap at each end.
Line 14 Tells the modeller to draw the object called BarBell
rotated slightly in the x and y axis's to get a better
view of it.
Additional statements would also be used to describe the surface
characteristics of the object, the position and brightness of lights
to be applied, the position of an imaginary camera through which we are
looking, and the resolution of the final picture. Although this type of
object could easily be made on a conventional modelling package, much
more complex objects can just as easily be described which would on a
conventional system require hours of tedious plotting of points.